package com.sharker.application;

import android.app.Application;

import com.facebook.stetho.Stetho;
import com.sharker.BuildConfig;
import com.sharker.R;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.weavey.loading.lib.LoadingLayout;

import org.xutils.x;

/**
 * 1. 类的用途
 * 2. @author：liqingyi
 * 3. @date：2017/4/6 21:52
 * https://github.com/futurice/android-best-practices
 */

public class App extends Application {

    public static App mInstance;
    private RefWatcher install;
    public static Boolean sBoolean = false;

    public static App getInstance() {
        return mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        install = LeakCanary.install(this);
        mInstance = this;
        Stetho.initializeWithDefaults(this);
        com.blankj.utilcode.util.Utils.init(this);

        x.Ext.init(this);
        x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.
        LoadingLayout.getConfig()
                .setErrorText("出错啦~请稍后重试！")
                .setEmptyText("抱歉，暂无数据")
                .setNoNetworkText("无网络连接，请检查您的网络···")
                .setErrorImage(R.mipmap.define_error)
                .setEmptyImage(R.mipmap.define_empty)
                .setNoNetworkImage(R.mipmap.define_nonetwork)
                .setAllTipTextColor(R.color.colorBlack)
                .setAllTipTextSize(14)
                .setReloadButtonText("点我重试哦")
                .setReloadButtonTextSize(14)
                .setReloadButtonTextColor(R.color.colorBlack)
                .setReloadButtonWidthAndHeight(150, 40);
    }
}
